<?php

namespace Api\Openapi\Callcenter;

use Api\Openapi\Util;

class Callout {
    const URL = '/callcenter/callout';

    /**
     * 呼起电话
     *
     * @param string $call_in           呼入电话
     * @param string $call_user_name    呼起用户
     * @param string $unique_flag       业务随机码/应用请求随机码
     * @param string $model_flag        模块请求标识
     * @return bool
     */
    public function call($call_in, $call_user_name, $unique_flag, $model_flag){

        $body = array(
            'call_in'     => $call_in,
            'call_user'         => $call_user_name,
            'unique_flag'       => $unique_flag,
            'model_flag'        => $model_flag
        );
        $params = array(
            "header" => array(),
            "body" => $body,
        );
        $result = Util::request(self::URL, $params);
        return !empty($result['body']) ? $result['body'] : false;
    }

}